package com.kongge.viewdisplayframeworklib.model;

import android.content.Context;
import android.text.TextUtils;

import com.kongge.viewdisplayframeworklib.R;
import com.kongge.viewdisplayframeworklib.control.GlobalMagager;

import java.util.HashMap;

public class ImageIdFactory {

	// ~常量区块
	// ========================================================

	// ~成员变量区块
	// ========================================================

	public static int getImageResourceIdForName(String name) {
		Context context = GlobalMagager.getGlobalActivity();
		if (context != null && !TextUtils.isEmpty(name)) {
			try {
				return context.getResources().getIdentifier(name, "drawable", context.getPackageName());
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return 0;
	}

}
